Skip to content

Conversation

snprajwal
Copy link
Contributor

Bug/issue #, if applicable: rdar://160284853

Summary

The @SupportedLanguage directive allows specifying a language that an article is available in. It can be used within the @Metadata directive like in the below example, where the article is made available in both Swift and Objective-C:


@Metadata {
  @SupportedLanguage(swift)
  @SupportedLanguage(objc)
}

This directive is processed when creating the topic graph node for the article. In cases where the article is the root page or a standalone article (when no technology root is defined), the directive is correctly processed as a part of registering the article in the documentation cache. However, in the case of a non-root article in a catalog containing a root article, this step was being skipped. This patch fixes this to ensure that the directive is processed for all articles in a catalog.

Dependencies

N/A

Testing

Unit tests have been added to test this functionality when creating the documentation node and reference for articles containing the directive.

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • Added tests
  • Ran the ./bin/test script and it succeeded
  • Updated documentation if necessary

The `@SupportedLanguage` directive allows specifying a language that an
article is available in. It can be used within the `@Metadata` directive
like in the below example, where the article is made available in both
Swift and Objective-C:

```

@metadata {
  @SupportedLanguage(swift)
  @SupportedLanguage(objc)
}
```

This directive is processed when creating the topic graph node for the
article. In cases where the article is the root page or a standalone
article (when no technology root is defined), the directive is correctly
processed as a part of registering the article in the documentation
cache. However, in the case of a non-root article in a catalog
containing a root article, this step was being skipped. This patch fixes
this to ensure that the directive is processed for all articles in a
catalog.

rdar://160284853
@snprajwal snprajwal force-pushed the pnadig/article-supported-lang branch from a7af0ff to 77cc7c5 Compare October 9, 2025 17:24
@snprajwal
Copy link
Contributor Author

@swift-ci please test

Comment on lines +834 to +838
let reference = if let supportedLanguages = article.supportedLanguages {
reference.withSourceLanguages(supportedLanguages)
} else {
reference
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICT there's no tests that verify this behavior. If it's needed; can you explain what it's for and add a test that verify that outcome?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants